package com.example.login.Mapper;

import com.example.login.Pojo.Goods;
import com.example.login.Pojo.PCGoods;
import com.example.login.Pojo.mobileGoods;
import com.example.login.Pojo.mp3Goods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
@Mapper
public interface SearchMap
{
    @Select("select id,seller_id,item_name,store_name,brand_name,goodImage,cid," +
            "fright,goodStatus,sell_num,min_price from xtshop_goods natural join " +
            "xtshop_mp3 where INSTR(#{words},item_name) or INSTR(#{words},brand_name) or " +
            "INSTR(#{words},cid) or INSTR(#{words},color) or INSTR(#{words},rom) or INSTR(#{words},combination)" +
            "or INSTR(Introduction,#{words});" )
    ArrayList<Goods> searchMp3(String words);
    @Select("select id,seller_id,item_name,store_name,brand_name,goodImage,cid," +
            "fright,goodStatus,sell_num,min_price from xtshop_goods natural join " +
            "xtshop_pc where INSTR(#{words},item_name) or INSTR(#{words},brand_name) or " +
            "INSTR(#{words},cid) or INSTR(#{words},color) or INSTR(#{words},rom) " +
            "or INSTR(#{words},ram) or INSTR(#{words},combination)" +
            "or INSTR(Introduction,#{words});" )
    ArrayList<Goods> searchPc(String words);
    @Select("select id,seller_id,item_name,store_name,brand_name,goodImage,cid," +
            "fright,goodStatus,sell_num,min_price from xtshop_goods natural join " +
            "xtshop_mobilephone where INSTR(#{words},item_name) or INSTR(#{words},brand_name) or " +
            "INSTR(#{words},cid) or INSTR(#{words},color) or INSTR(#{words},rom) " +
            "or INSTR(#{words},ram) or INSTR(#{words},network) or INSTR(#{words},combination)" +
            "or INSTR(Introduction,#{words});" )
    ArrayList<Goods> searchMobile(String words);
    @Select("select *from xtshop_goods natural join " +
            "xtshop_mp3 where INSTR(#{words},item_name) or INSTR(item_name,#{words}) or " +
            " INSTR(Introduction,#{words});" )
    ArrayList<mp3Goods> searchMp3ByItemName(String words);
    @Select("select *from xtshop_goods natural join " +
            "xtshop_pc where INSTR(#{words},item_name) or INSTR(item_name,#{words}) or " +
            "INSTR(Introduction,#{words});" )
    ArrayList<PCGoods> searchPcByItemName(String words);
    @Select("select *from xtshop_goods natural join " +
            "xtshop_mobilephone where INSTR(#{words},item_name) or INSTR(item_name,#{words}) or " +
            " INSTR(Introduction,#{words});" )
    ArrayList<mobileGoods> searchMobileByItemName(String words);
}
